import { createSlice } from '@reduxjs/toolkit';

const initialState = {
  theme: 'light',
  language: 'en',
  isLogin: false,
};

const mainStore = createSlice({
  name: 'main',
  initialState,
  reducers: {
    initMainState(state, action) {
      Object.assign(state, action.payload);
    },
    setTheme(state, action) {
      state.theme = action.payload;
    },
    setLanguage(state, action) {
      state.language = action.payload;
    },
    setIsLogin(state, action) {
      state.isLogin = action.payload;
    },
  },
});

export default mainStore;
